# Contributor: Milan P. Stanić <mps@arvanta.net>
# Maintainer: Milan P. Stanić <mps@arvanta.net>
pkgname=iwd
pkgver=1.8
pkgrel=0
pkgdesc="Internet Wireless Daemon"
url="https://iwd.wiki.kernel.org/"
arch="all"
license="LGPL-2.1-or-later"
makedepends="dbus-dev readline-dev linux-headers"
checkdepends="coreutils"
subpackages="$pkgname-doc $pkgname-openrc"
source="https://mirrors.edge.kernel.org/pub/linux/network/wireless/iwd-$pkgver.tar.gz
	dbus-netdev-group.patch
	fix-rawmemchr.patch
	iwd.initd
	main.conf
	iwd.post-upgrade
	"

case "$CARCH" in
mips*)	options="!check";;
esac

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var \
		--disable-systemd-service \
		--enable-sim-hardcoded \
		--enable-wired \
		--enable-tools
	make
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install
	install -m750 -d "$pkgdir"/var/lib/$pkgname
	install -m755 -D "$srcdir"/$pkgname.initd \
		"$pkgdir"/etc/init.d/$pkgname
	install -m644 -D "$srcdir"/main.conf \
		"$pkgdir"/etc/$pkgname/main.conf
}

sha512sums="413b24a04803d02a80688b72c595da0ed1043b754ad45ab4bfabeb1cf16c65f30a2e52dd7b4b846887ed15c42d47e2b40820e8c0afb62907c04dff2bf871d726  iwd-1.8.tar.gz
7d3bc26b558ebfd22335b946f09abd5326e885275979c617af7def1468ade23ba7605f3b13aaf91836035c130aaec04be0ff2708a898f3ae835e0eef4e78fa0e  dbus-netdev-group.patch
2d8cc70a9475465755f8187c6afb93e5792842dccf55f977ce111e98477517feae1be81eefd50c53149c61d7944a728dc504938ad678a2c789703bcc6f1e7507  fix-rawmemchr.patch
1a913fa19a76a18d92b8f44cb5b4b99a64b4e2f7d2b4a486bf1ba2f939aea7dcca772fca91483011ada58aaa3addc29c76ececd708b2187e57f72aa040ac77e6  iwd.initd
09f4097e653cfecfa1e4bc7b4843832785d0a8ef2a8ecf7daa3d5be704d9ac311fbbecf9f9f5b8b1c75beff894e4cf0d8fda4d6ff728a638dedf77aff0197179  main.conf
414cb08e01735a66dfb57eac7f308ce75f8f7adf679c5e38418293a0acb2398f9b4df4dd50a6756e48eb03b86de1546e2f852a28677842f2c453a0db86d49f71  iwd.post-upgrade"
